How the Menu Manager Maintains Information About Menus
The Menu Manager maintains information about menus in menu records. Each menu record includes certain information about a specific menu, including
You typically specify most of this information in a menu resource, that is, a resource of type
- the menu ID of the menu
- the horizontal and vertical dimensions of the menu (in pixels)
- a handle to the menu definition procedure of the menu
- flags indicating whether each item (for the first 31 items) is enabled or disabled and whether the menu title is enabled or disabled
- the contents of the menu, including the menu title and other data that defines the menu items
'MENU'
. When you create a menu, the Menu Manager stores this information in a menu record. A menu record is a data structure of typeMenuInfo
. You usually never need to access the information in the menu record directly; the Menu Manager automatically updates the menu record when you make any changes to the menu, such as adding a menu item. See "The Menu Record" beginning on page 3-97 if you need to access the fields of the menu record directly.The Menu Manager identifies every menu by a number referred to as a menu ID. You must assign a menu ID to each menu in your application. Each menu in your application must have a menu ID that is unique from that of any other menu in your application. You can use any number greater than 0 for a menu ID of a pull-down or pop-up menu; submenus of an application can use only menu IDs from 1 through 235; submenus of a desk accessory must use menu IDs from 236 through 255.
When you create a menu, the Menu Manager creates a menu record for the menu and returns a handle to that menu record. To refer to a menu, you usually use either the menu's menu ID or a handle to the menu's menu record.
To refer to a menu item, use the menu item's item number. Item numbers identify items in menus; items are assigned item numbers starting with 1 for the first menu item in the menu, 2 for the second menu item in the menu, and so on, up to the number of the last menu item in the menu.